<?php
declare (strict_types = 1);

namespace app\admin\controller;

use addons\Builder\facade\Builder;
use think\Response;
use think\response\Json;
//该文件为自动生成，请按需修改
class WholesaleProduct extends Base
{
    //主键，默认为id
    protected string $pk = 'id';

    //主模型
    protected string $model = '\app\common\model\WholesaleProduct';
    protected $append = ['toal_text'];

    public function index(): string
    {
       return Builder::Table()
           ->autoStructure($this->model, $this->pk, 'barDemo,200')
           ->addRightButtons(['edit' => ['size' => '60%'], 'delete'])
           ->addTopButtons(['add' => ['size' => '60%'], 'deleteAll'])
           ->fetch();
    }
    public function save($param = [], $model = false): Json
    {
        $param = $this->request->post();
        $param['win_bl'] = $param['win_bl'] / 100;
        $param['fail_bl'] = $param['fail_bl'] / 100;
        $param['take_bl'] = $param['take_bl'] / 100;
        return parent::save($param, $model); // TODO: Change the autogenerated stub
    }
}
